using System;
using System.Data;
using System.Collections.Generic;

namespace shfa.snomtastic.data.business
{
    public partial class CategoryController
    {
		private CategoryInfo ObjectFromDataRow(DataRow dr)
        {
            if (dr != null)
            {
				CategoryInfo obj = new CategoryInfo();
				obj.CategoryId = dr.Field<Guid>("CategoryId"); 
				obj.Name = (dr["Name"] != DBNull.Value) ? dr.Field<String>("Name") : string.Empty; 
				return obj;
            }
            return null;
        }

        private List<CategoryInfo> ListFromDataTable(DataTable dt)
        {
            List<CategoryInfo> lst = new List<CategoryInfo>();

            foreach (DataRow dr in dt.Rows)
            {
                lst.Add(ObjectFromDataRow(dr));
            }

            return lst;
        }
    }
}
